﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using GCalendar = Google.GData.Calendar;
using Google.GData.Extensions;

namespace GJReminder.Model
{
    class CreatEventModel
    {
        public string Title { get; set; }
        public string Description { get; set; }
        public string Location { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }

        public GCalendar.EventEntry GetEventEntry()
        {
            if (null == Title || DateTime.MinValue == StartTime)
            {
                return null;
            }

            GCalendar.EventEntry entry = new GCalendar.EventEntry(Title, Description, Location);
            When eventTime = new When(StartTime, EndTime);
            entry.Times.Add(eventTime);
            return entry;
        }
    }
}
